home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Sample Code / Music Architecture / Mixed Bag / •Instrument Editor / Instrument Tests.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-20  |  1.7 KB  |  94 lines  |  [TEXT/KAHL]

  1.  
  2. #include "BigEasy2.h"
  3. #include "BigEasyDialogs.h"
  4. #include "Instrument Editor.h"
  5.  
  6. static long gScale = 12;
  7.  
  8. void PitchBendDoc(short n, short menuItem, short menuRef)
  9.     {
  10.     long t;
  11.     long i;
  12.     long x;
  13.     TDoc *d;
  14.     ComponentResult result;
  15.  
  16.     d = &gDoc[n - kFirstDocWindow];
  17.  
  18.     x = EasyDialogGetNumber("\pScale",
  19.             "\pNumber of notes in equal tempered octave:",
  20.             &gScale);
  21.  
  22.     if(x && gScale > 0 && gScale < 100)
  23.         {
  24.         GoWatch();
  25.         result = MusicPlayNote(d->ci,1,60,100);
  26.         Delay(15,&t);
  27.         for(i = -gScale; i <= gScale; i++)
  28.             {
  29.             MusicSetController(d->ci,1,kControllerPitchBend,i * (12<<8) / gScale);
  30.             Delay(12,&t);
  31.             }
  32.         result = MusicPlayNote(d->ci,1,60,0);        
  33.         MusicSetController(d->ci,1,kControllerPitchBend,0);
  34.         }
  35.  
  36.  
  37.     GoArrow();
  38.     }
  39.  
  40. void MicrotoneDoc(short n, short menuItem, short menuRef)
  41.     {
  42.     long t;
  43.     long i;
  44.     long x;
  45.     long p;
  46.     TDoc *d;
  47.     ComponentResult result;
  48.  
  49.     d = &gDoc[n - kFirstDocWindow];
  50.  
  51.     x = EasyDialogGetNumber("\pScale",
  52.             "\pNumber of notes in equal tempered octave:",
  53.             &gScale);
  54.  
  55.     if(x && gScale > 0 && gScale < 100)
  56.         {
  57.         GoWatch();
  58.         Delay(15,&t);
  59.         for(i = -gScale; i <= gScale; i++)
  60.             {
  61.             p = (60<<8) + (i * (12<<8) / gScale);
  62.             result = MusicPlayNote(d->ci,1, p,100);
  63.             Delay(12,&t);
  64.             result = MusicPlayNote(d->ci,1, p,0);
  65.             Delay(3,&t);
  66.             }
  67.         }
  68.  
  69.  
  70.     GoArrow();
  71.     }
  72.  
  73.  
  74. void NotesOnDoc(short n, short menuItem, short menuRef)
  75.     {
  76.     ComponentResult result;
  77.     TDoc *d;
  78.  
  79.     d = &gDoc[n - kFirstDocWindow];
  80.     result = MusicPlayNote(d->ci,1,60,100);
  81.     result = MusicPlayNote(d->ci,1,67,70);
  82.     }
  83.  
  84. void NotesOffDoc(short n, short menuItem, short menuRef)
  85.     {
  86.     ComponentResult result;
  87.     TDoc *d;
  88.  
  89.     d = &gDoc[n - kFirstDocWindow];
  90.     result = MusicPlayNote(d->ci,1,60,0);
  91.     result = MusicPlayNote(d->ci,1,67,0);
  92.     }
  93.  
  94.